﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using IFRS.DataAccess.DAL;

namespace IFRS.DataAccess.DAL
{
    public class TREEVIEW
    {
        public DataTable MAINMENU_SEARCH_ALL()
        {
            DataTable dt = new DataTable();
            IFRS_Utility Utility = new IFRS_Utility();
            List<SqlParameter> lstParams = new List<SqlParameter>();
            try
            {
                dt = Utility.StoredProcDataTable("SPR_TREEVIEW_MAINMENU_SEARCHALL", lstParams.ToArray());
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return dt;
        }

        public DataTable MAINMENU_USER_SEARCH_ALL(int iRoleGroupID)
        {
            DataTable dt = new DataTable();
            IFRS_Utility Utility = new IFRS_Utility();
            List<SqlParameter> lstParams = new List<SqlParameter>();
            try
            {
                lstParams.Add(new SqlParameter("@RoleGroupID", iRoleGroupID));
                dt = Utility.StoredProcDataTable("SPR_TREEVIEW_MAINMENU_USER_SEARCHALL", lstParams.ToArray());
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return dt;
        }

        public DataTable SUBMAINMENU_SEARCH_BYID(int iMENUCATEGORYID)
        {
            DataTable dt = new DataTable();
            IFRS_Utility Utility = new IFRS_Utility();
            List<SqlParameter> lstParams = new List<SqlParameter>();
            try
            {
                lstParams.Add(new SqlParameter("@MENUCATEGORYID", iMENUCATEGORYID));
                dt = Utility.StoredProcDataTable("SPR_TREEVIEW_SUBMAINMENU_SEARCHBYID", lstParams.ToArray());
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return dt;
        }

        public DataTable SUBMAINMENU_USER_SEARCH_BYID(int iRoleGroupID,int iMENUCATEGORYID)
        {
            DataTable dt = new DataTable();
            IFRS_Utility Utility = new IFRS_Utility();
            List<SqlParameter> lstParams = new List<SqlParameter>();
            try
            {
                lstParams.Add(new SqlParameter("@RoleGroupID", iRoleGroupID));
                lstParams.Add(new SqlParameter("@MENUCATEGORYID", iMENUCATEGORYID));
                dt = Utility.StoredProcDataTable("SPR_TREEVIEW_SUBMAINMENU_USER_SEARCHBYID", lstParams.ToArray());
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return dt;
        }

        public DataTable MENU_SEARCH_BYID(int iMENUSUBCATEGORYID)
        {
            DataTable dt = new DataTable();
            IFRS_Utility Utility = new IFRS_Utility();
            List<SqlParameter> lstParams = new List<SqlParameter>();
            try
            {
                lstParams.Add(new SqlParameter("@MENUSUBCATEGORYID", iMENUSUBCATEGORYID));
                dt = Utility.StoredProcDataTable("SPR_TREEVIEW_MENU_SEARCHBYID", lstParams.ToArray());
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return dt;
        }

        public DataTable MENU_USER_SEARCH_BYID(int iRoleGroupID,int iMENUSUBCATEGORYID)
        {
            DataTable dt = new DataTable();
            IFRS_Utility Utility = new IFRS_Utility();
            List<SqlParameter> lstParams = new List<SqlParameter>();
            try
            {
                lstParams.Add(new SqlParameter("@RoleGroupID", iRoleGroupID));
                lstParams.Add(new SqlParameter("@MENUSUBCATEGORYID", iMENUSUBCATEGORYID));
                dt = Utility.StoredProcDataTable("SPR_TREEVIEW_MENU_USER_SEARCHBYID", lstParams.ToArray());
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return dt;
        }
    }
}
